package org.hrqing.authorization.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Column;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.annotations.Type;
import org.hibernate.type.SqlTypes;
import org.hrqing.authorization.entity.mapper.BaseEntity;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @auther Hrqing
 */
@Getter
@Setter
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_client")
public class Client extends BaseEntity {

    private String clientId;

    private LocalDateTime clientIdIssuedAt;

    private String clientSecret;

    private LocalDateTime clientSecretExpiresAt;

    private String clientName;

    @Column(columnDefinition = "varchar")
    private String clientAuthenticationMethods;

    @Column(columnDefinition = "varchar")
    private String authorizationGrantTypes;

    @Column(columnDefinition = "varchar")
    private String redirectUris;

    @Column(columnDefinition = "varchar")
    private String postLogoutRedirectUris;

    @Column(columnDefinition = "varchar")
    private String scopes;

    @JdbcTypeCode(SqlTypes.JSON)
    private String clientSettings;

    @JdbcTypeCode(SqlTypes.JSON)
    private String tokenSettings;
}
